import { createSSRApp } from "vue";
import {createPinia} from "pinia"//引入pinia
import piniaPluginPersistedstate  from 'pinia-plugin-persistedstate'
import drawerTab from './components/drawer-tab.vue'
import tabbar from './components/tabbar.vue'
import list from './components/list.vue'
import App from "./App.vue";
import './utils/cloud_sdk_init'

//引入LeanCloud
import AV from 'leancloud-storage'


export function createApp() {
  const app = createSSRApp(App);
  
  
  //leanCloud初始化
  AV.init({
    appId: 'vse2rwc881jiN17cc1LYGF3M-gzGzoHsz', 
    appKey: '76qslkncQYxQYFaNCdZ4DPeD',        
    serverURLs: 'https://vse2rwc8.lc-cn-n1-shared.com'
  })
  
  
  //挂载leanCloud
  app.config.globalProperties.$AV = AV;
  
  
  const pinia = createPinia()//返回一个vue插件
  pinia.use(piniaPluginPersistedstate)// 注册持久化插件
  app.use(pinia)//使用pinia
  app.component('drawer-tab',drawerTab)
  app.component('tabbar',tabbar)
  app.component('list',list)
  return {
    app,
	pinia,
  };
}
